#include <iostream>
#include <cstdio>

using namespace std;

#define lson l, m, rt << 1
#define rson m + 1, r, rt << 1 | 1

const int maxn = 55555;

int n;

int sum[maxn << 2];

void PushUp(int rt) {
	sum[rt] = sum[rt << 1] + sum[rt << 1 | 1];
}

void build(int l, int r, int rt) {
	if (l == r) {
		cin >> sum[rt];
		cout << "rt = " << rt << endl;
		return;
	}
	int m = (l + r) >> 1;
	build(lson);
	build(rson);
	PushUp(rt);
}

void update(int p, int add, int l, int r, int rt) {
	if (l == r) {
		sum[rt] += add;
		return;
	}
	int m = (l + r) >> 1;
	if (p <= m) update(p, add, lson);
	else update(p, add, rson);
	PushUp(rt);
}

int query(int L, int R, int l, int r, int rt) {
	if (L <= l && r <= R) {
		return sum[rt];
	}
	int m = (l + r) >> 1;
	int ret = 0;
	if (L <= m) ret += query(L, R, lson);
	if (R > m) ret += query(L, R, rson);
	return ret;
}

int main() {
	int t;
	cin >> t;
	for (int cases = 1; cases <= t; cases++) {
		cout << "Case " << cases << ":" << endl;
		cin >> n;
		build(1, n, 1);
		char op[10];
		while(scanf("%s", op)) {
			if (op[0] == 'E') break;
			int a, b;
			cin >> a >> b;
			if (op[0] == 'Q') cout << query(a, b, 1, n, 1) << endl;
			else if (op[0] == 'S') update(a, -b, 1, n, 1);
			else update(a, b, 1, n, 1);
		}
	}
}